package com.campus.help.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 认证状态枚举
 *
 * @author campus-help
 * @since 2025-09-18
 */
@Getter
@AllArgsConstructor
public enum VerifyStatus {

    /**
     * 未认证
     */
    UNVERIFIED(0, "未认证"),

    /**
     * 已认证
     */
    VERIFIED(1, "已认证"),

    /**
     * 认证失败
     */
    FAILED(2, "认证失败");

    /**
     * 状态码
     */
    private final Integer code;

    /**
     * 状态描述
     */
    private final String description;

    /**
     * 根据状态码获取枚举
     */
    public static VerifyStatus fromCode(Integer code) {
        for (VerifyStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown verify status code: " + code);
    }
}
